<template> 
      <el-menu
        :default-active="infotype"
        mode="horizontal"
        @select="setInfotype"
        class="menus"
        background-color="rgb(48, 65, 86)"
        text-color="rgb(191, 203, 217)"
        active-text-color="#409eff"
        :router="true"
      >
        
        <el-menu-item :index="'/xm/project/view/overview?projectId='+projectInfo.id">
          <template #title>
          <div class="flex items-center"
            style="max-width: 25em;font-weight: 600; font-size: 20px; color: #E6A23C"  
            :title="projectInfo.name"
          >  
              &nbsp;<el-avatar   style="background-color:#E6A23C;;width:50px;min-width: 50px;border: 2px solid silver;">项目</el-avatar> 
              &nbsp;<el-text size="large" truncated type="warning"><div style="max-width: 30em;font-weight: 600; font-size: 20px; color: #E6A23C">{{ projectInfo.name}}</div></el-text> 
            
          </div> 
        </template>
        </el-menu-item>
				<el-menu-item label="需求" :index="'/xm/project/view/menu?projectId='+projectInfo.id">
					 <template #title><icon icon="fa:envira"/>需求</template> 
				</el-menu-item> 
        <el-sub-menu index="jihua">
          <template #title><icon icon="fa:google-plus-circle"/>计划</template>
          <el-menu-item :index="'/xm/project/view/plan?projectId='+projectInfo.id">
            <template #title><icon icon="ep:stopwatch"/>总体计划</template>
          </el-menu-item>  
          
          <el-menu-item :index="'/xm/project/view/iteration?projectId='+projectInfo.id">
            <template #title><icon icon="ep:connection"/>迭代计划</template>
          </el-menu-item> 
          <el-menu-item :index="'/xm/project/view/test/plan?projectId='+projectInfo.id">
            <template #title><icon icon="fa:fire"/>测试计划</template>
          </el-menu-item>
          <el-menu-item :index="'/xm/project/view/task?projectId='+projectInfo.id">
            <template #title><icon icon="ep:operation"/>任务列表</template>
          </el-menu-item>  
          <el-menu-item :index="'/xm/project/view/milestone?projectId='+projectInfo.id">
            <template #title><icon icon="ep:star-filled"/>里程碑</template>
          </el-menu-item>
        </el-sub-menu>
        <el-menu-item :index="'/xm/project/view/question?projectId='+projectInfo.id">
          <template #title><icon icon="fa:bug"/>问题</template>
        </el-menu-item>
        
        <el-sub-menu index="risk">
          <template #title><icon icon="fa-solid:shield-virus"/>风险</template>
          <el-menu-item :index="'/xm/pro/project/view/risk/index?projectId='+projectInfo.id">
            <template #title><icon icon="fa-solid:shield-virus"/>风险管理</template>
          </el-menu-item>
          <el-menu-item :index="'/xm/pro/project/view/risk/overview?projectId='+projectInfo.id">
            <template #title><icon icon="fa-solid:shield-alt"/>风险分析</template>
          </el-menu-item>
        </el-sub-menu>
        <el-menu-item :index="'/xm/project/view/group?projectId='+projectInfo.id">
          <template #title><icon icon="fa:sitemap"/>团队</template>
        </el-menu-item>
        <el-sub-menu index="caiwu">
          <template #title><icon icon="fa-solid:coins"/>财务</template>
          <el-menu-item :index="'/xm/pro/project/view/contract?projectId='+projectInfo.id">
            <template #title><icon icon="fa-solid:balance-scale"/>合同管理</template>
          </el-menu-item>
          <el-menu-item :index="'/xm/pro/project/view/budget?projectId='+projectInfo.id">
            <template #title><icon icon="ep:coin"/>预算</template>
          </el-menu-item>
          <el-menu-item :index="'/xm/pro/project/view/budget/create?projectId='+projectInfo.id">
            <template #title><icon icon="ep:coin"/>创建预算单据</template>
          </el-menu-item>
          <el-menu-item :index="'/xm/pro/project/view/cost?projectId='+projectInfo.id">
            <template #title><icon icon="fa-solid:shopping-cart"/>费用</template>
          </el-menu-item>
          <el-menu-item :index="'/xm/pro/project/view/cost/create?projectId='+projectInfo.id">
            <template #title><icon icon="fa-solid:shopping-cart"/>创建费用单</template>
          </el-menu-item>
          <el-menu-item :index="'/xm/project/view/workloadDay?projectId='+projectInfo.id">
            <template #title
              ><icon icon="fa-solid:user-clock"/>每日工时</template
            >
          </el-menu-item>
          <el-menu-item :index="'/xm/pro/project/view/workloadMonth?projectId='+projectInfo.id">
            <template #title
              ><icon icon="fa-solid:user-cog"/>每月工时</template
            >
          </el-menu-item>   
        </el-sub-menu>
          <el-sub-menu index="kpi">
            <template #title><icon icon="fa:bar-chart"/>效能</template>
          <el-menu-item :index="'/xm/pro/project/view/kpi/mng?projectId='+projectInfo.id">
            <template #title><icon icon="fa:key"/>kpi管理</template>
          </el-menu-item>
          <el-menu-item :index="'/xm/pro/project/view/kpi/kself?projectId='+projectInfo.id">
            <template #title><icon icon="fa-solid:sun"/>我负责的kpi</template>
          </el-menu-item>
          <el-menu-item :index="'/xm/pro/project/view/kpi/kadm?projectId='+projectInfo.id">
            <template #title><icon icon="fa-solid:user-check"/>我审核的kpi</template>
          </el-menu-item>
          <el-menu-item :index="'/xm/pro/project/view/kpi/overview?projectId='+projectInfo.id">
            <template #title><icon icon="fa-solid:chart-line"/>kpi统计分析</template>
          </el-menu-item>
          <el-menu-item :index="'/xm/pro/project/view/kpi/his?projectId='+projectInfo.id">
            <template #title><icon icon="fa:history"/>考核记录</template>
          </el-menu-item> 
          <el-menu-item :index="'/xm/pro/project/view/rpt?projectId='+projectInfo.id">
            <template #title><icon icon="fa:bar-chart"/>效能分析</template>
          </el-menu-item>
        </el-sub-menu>
        <el-sub-menu index="zhishi">
          <template #title><icon icon="fa:book"/>知识</template>
          <el-menu-item :index="'/xm/project/view/file?projectId='+projectInfo.id">
            <template #title><icon icon="ep:document"/>文档</template>
          </el-menu-item>
          <el-menu-item :index="'/xm/project/view/record?projectId='+projectInfo.id">
            <template #title><icon icon="ep:edit"/>日志</template>
          </el-menu-item>
          
          <el-menu-item :index="'/xm/project/view/dynamics?projectId='+projectInfo.id">
            <template #title><icon icon="ep:bell"/>动态</template>
          </el-menu-item>
        </el-sub-menu>
        
        <el-sub-menu index="flow">
          <template #title><icon icon="fa-solid:random"/>审批 </template>
          <el-menu-item :index="'/xm/project/view/setup?projectId='+projectInfo.id">
            <template #title><icon icon="ep:star"/>立项提审</template>
          </el-menu-item>
          <el-menu-item :index="'/xm/project/view/accept?projectId='+projectInfo.id">
            <template #title><icon icon="ep:finished"/>结项提审</template>
          </el-menu-item>
          <el-menu-item :index="'/xm/project/view/comm/change?projectId='+projectInfo.id">
            <template #title><icon icon="ep:switch"/>通用变更提审</template>
          </el-menu-item>
          <el-menu-item :index="'/xm/project/view/currFlow?projectId='+projectInfo.id">
            <template #title><icon icon="fa-solid:random"/>当前审批</template>
          </el-menu-item>
          <el-menu-item :index="'/xm/project/view/hisFlow?projectId='+projectInfo.id">
            <template #title><icon icon="fa:calendar-check-o"/>历史审批</template>
          </el-menu-item>  
        </el-sub-menu>
        <el-sub-menu index="shezhi">
          <template #title><icon icon="ep:setting"/>配置</template>
          <el-menu-item :index="'/xm/project/view/detail?projectId='+projectInfo.id">
            <template #title><icon icon="ep:document"/>项目详情</template>
          </el-menu-item>
          <el-menu-item :index="'/xm/project/view/setting?projectId='+projectInfo.id">
            <template #title><icon icon="ep:setting"/>项目配置</template>
          </el-menu-item>  
          <el-menu-item :index="'/xm/project/view/product?projectId='+projectInfo.id">
            <template #title><icon icon="fa:product-hunt"/>关联产品</template>
          </el-menu-item> 
          <el-menu-item :index="'/xm/project/view/env?projectId='+projectInfo.id">
            <template #title><icon icon="ep:setting"/>环境清单</template>
          </el-menu-item>
        </el-sub-menu>
        
        
        <el-menu-item :index="'/'">
          <template #title><icon icon="fa:home"/></template>
        </el-menu-item>
        <el-menu-item>
           <Screenfull/> 
        </el-menu-item>
      </el-menu> 
      
</template>

<script>  

import { Screenfull } from '@/layout/components/Screenfull'
import { mapState } from 'pinia'
import { useUserStore } from '@/store/modules/user'
import { useXmStore } from '@/store/modules/xm'

export default {
  props: ["visible"],
  computed: {
    ...mapState(useUserStore,["userInfo", "roles"]), 
    ...mapState(useXmStore,['projectInfo']),
  },
  watch: {
    $route:{
      handler(newVal,oldValu){ 
        this.infotype=newVal.fullPath 
      },
      deep:true,
      immediate:true,
    }
  },
  data() {
    return { 
      infotype:'',  
    };
  }, //end data
  methods: {    
    setInfotype(infotype) {  
        this.infotype = infotype;  
    }, 
     
  }, //end methods
  components: {
    Screenfull
    //在下面添加其它组件
  }, 
  mounted() {   
    this.infotype=this.$route.fullPath
  },
};
</script>

<style rel="stylesheet/scss" lang="scss" scoped>
.menus {
  .el-menu-item {  
    padding-left: 10px !important; 
    padding-right: 10px !important; 
  }
}
.menus {
  .el-sub-menu{ 
    width:110px; 
  }
}
/* 超过宽度则用...代替 */
.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.step-btn{
	margin-left:0px;margin-bottom: 5px;
}
 
</style>
